3.31 \(\int \cos (c+d x) (a+i a \tan (c+d x))^2 \, dx\)

Optimal. Leaf size=46 \[ -\frac {a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 i \cos (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d} \]

[Out]

-a^2*arctanh(sin(d*x+c))/d-2*I*cos(d*x+c)*(a^2+I*a^2*tan(d*x+c))/d

________________________________________________________________________________________

Rubi [A]  time = 0.03, antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 22, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {3496, 3770} \[ -\frac {a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 i \cos (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d} \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]*(a + I*a*Tan[c + d*x])^2,x]

[Out]

-((a^2*ArcTanh[Sin[c + d*x]])/d) - ((2*I)*Cos[c + d*x]*(a^2 + I*a^2*Tan[c + d*x]))/d

Rule 3496

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(2*b*(
d*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1))/(f*m), x] - Dist[(b^2*(m + 2*n - 2))/(d^2*m), Int[(d*Sec[e + f
*x])^(m + 2)*(a + b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, d, e, f}, x] && EqQ[a^2 + b^2, 0] && GtQ[n,
1] && ((IGtQ[n/2, 0] && ILtQ[m - 1/2, 0]) || (EqQ[n, 2] && LtQ[m, 0]) || (LeQ[m, -1] && GtQ[m + n, 0]) || (ILt
Q[m, 0] && LtQ[m/2 + n - 1, 0] && IntegerQ[n]) || (EqQ[n, 3/2] && EqQ[m, -2^(-1)])) && IntegerQ[2*m]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin {align*} \int \cos (c+d x) (a+i a \tan (c+d x))^2 \, dx &=-\frac {2 i \cos (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}-a^2 \int \sec (c+d x) \, dx\\ &=-\frac {a^2 \tanh ^{-1}(\sin (c+d x))}{d}-\frac {2 i \cos (c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [B]  time = 0.27, size = 180, normalized size = 3.91 \[ \frac {a^2 \left (\cos \left (\frac {1}{2} (c+5 d x)\right )+i \sin \left (\frac {1}{2} (c+5 d x)\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right ) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )-2 i\right )+\sin \left (\frac {1}{2} (c+d x)\right ) \left (-i \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+i \log \left (\sin \left (\frac {1}{2} (c+d x)\right )+\cos \left (\frac {1}{2} (c+d x)\right )\right )+2\right )\right )}{d (\cos (d x)+i \sin (d x))^2} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]*(a + I*a*Tan[c + d*x])^2,x]

[Out]

(a^2*(Cos[(c + d*x)/2]*(-2*I + Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x)
/2]]) + (2 - I*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + I*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]])*Sin[(c +
 d*x)/2])*(Cos[(c + 5*d*x)/2] + I*Sin[(c + 5*d*x)/2]))/(d*(Cos[d*x] + I*Sin[d*x])^2)

________________________________________________________________________________________

fricas [A]  time = 0.53, size = 52, normalized size = 1.13 \[ \frac {-2 i \, a^{2} e^{\left (i \, d x + i \, c\right )} - a^{2} \log \left (e^{\left (i \, d x + i \, c\right )} + i\right ) + a^{2} \log \left (e^{\left (i \, d x + i \, c\right )} - i\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+I*a*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

(-2*I*a^2*e^(I*d*x + I*c) - a^2*log(e^(I*d*x + I*c) + I) + a^2*log(e^(I*d*x + I*c) - I))/d

________________________________________________________________________________________

giac [A]  time = 1.19, size = 56, normalized size = 1.22 \[ \frac {-2 i \, a^{2} e^{\left (i \, d x + i \, c\right )} - a^{2} \log \left (i \, e^{\left (i \, d x + i \, c\right )} - 1\right ) + a^{2} \log \left (-i \, e^{\left (i \, d x + i \, c\right )} - 1\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+I*a*tan(d*x+c))^2,x, algorithm="giac")

[Out]

(-2*I*a^2*e^(I*d*x + I*c) - a^2*log(I*e^(I*d*x + I*c) - 1) + a^2*log(-I*e^(I*d*x + I*c) - 1))/d

________________________________________________________________________________________

maple [A]  time = 0.30, size = 53, normalized size = 1.15 \[ -\frac {2 i a^{2} \cos \left (d x +c \right )}{d}+\frac {2 a^{2} \sin \left (d x +c \right )}{d}-\frac {a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)*(a+I*a*tan(d*x+c))^2,x)

[Out]

-2*I/d*a^2*cos(d*x+c)+2*a^2*sin(d*x+c)/d-1/d*a^2*ln(sec(d*x+c)+tan(d*x+c))

________________________________________________________________________________________

maxima [A]  time = 0.37, size = 61, normalized size = 1.33 \[ -\frac {a^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right ) - 2 \, \sin \left (d x + c\right )\right )} + 4 i \, a^{2} \cos \left (d x + c\right ) - 2 \, a^{2} \sin \left (d x + c\right )}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+I*a*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/2*(a^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1) - 2*sin(d*x + c)) + 4*I*a^2*cos(d*x + c) - 2*a^2*sin(
d*x + c))/d

________________________________________________________________________________________

mupad [B]  time = 3.37, size = 41, normalized size = 0.89 \[ -\frac {2\,a^2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}+\frac {4\,a^2}{d\,\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+1{}\mathrm {i}\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)*(a + a*tan(c + d*x)*1i)^2,x)

[Out]

(4*a^2)/(d*(tan(c/2 + (d*x)/2) + 1i)) - (2*a^2*atanh(tan(c/2 + (d*x)/2)))/d

________________________________________________________________________________________

sympy [A]  time = 0.29, size = 68, normalized size = 1.48 \[ \frac {a^{2} \left (\log {\left (e^{i d x} - i e^{- i c} \right )} - \log {\left (e^{i d x} + i e^{- i c} \right )}\right )}{d} + \begin {cases} - \frac {2 i a^{2} e^{i c} e^{i d x}}{d} & \text {for}\: d \neq 0 \\2 a^{2} x e^{i c} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)*(a+I*a*tan(d*x+c))**2,x)

[Out]

a**2*(log(exp(I*d*x) - I*exp(-I*c)) - log(exp(I*d*x) + I*exp(-I*c)))/d + Piecewise((-2*I*a**2*exp(I*c)*exp(I*d
*x)/d, Ne(d, 0)), (2*a**2*x*exp(I*c), True))

________________________________________________________________________________________